var ChatVideoMsg = (function(){    
    var _videoMsgTmp = [
        '<div class="videoMsgWrapper" style="position:relative;cursor:pointer;">',
            '<img src="<%=o.poster%>" />',
            '<img src="/ujs/images/common32/video.png"  style="position: absolute;top: calc(50% - 16px);left: calc(50% - 16px);z-index: 9;background: #FFF;border-radius: 14px;clip: rect(5px 31px 27px 1px);"/>',                
        '</div>',
        '<div class="msgMetadata">',
            'Duration:<%=o.content.duration%>&#39;&#39;.',
            '&nbsp;<span class="dbtn" onclick="ujs.browser.file.downloadFromLink(\'<%=o.src%>\', \'video.mp4\')">Download</span>',
        '</div>'      
    ].join('');
    
    var _chatVideoMsg = (function ChatVideoMsg(){
    }).extend(ChatMsg, 'ChatVideoMsg');
    
    _chatVideoMsg.prototype._init = function(){
        var _this = this;
        var $videoMsg = $(tmpl(_videoMsgTmp, this.msg));        
        
        this.$wrapper.find('.chatMsgItemContent').prepend($videoMsg);
        
        $videoMsg.find('img').click(function(){
            ujs.ui.Dialog.get(ujs.subjects.dialog.VideoPreviewDialog, {
                meta : _this.msg,
                bodyStyle : {
                    'overflow' : 'auto',
                    'text-align' : 'center'
                }
            });
        });
    };
    return _chatVideoMsg;
})();